#pragma once

#include <string>
#include "util.hpp"

namespace pharmacy_server
{
    struct Result
    {
        Result(int code, const std::string& desc)
            : code(code), desc(desc), data("{}")
        {
        }

        Result(int code, const std::string& desc, const std::string& data)
            : code(code), desc(desc), data(data)
        {
        }

        int code;
        std::string desc;
        std::string data;

        std::string serialize()
        {
            Json::Value root;
            root["code"] = code;
            root["desc"] = desc;
            root["data"] = data;

            return json_util::serialize(root);
        }

        const static int SUCCESS = 200;
        const static int FAILED = 401;
    };
}